//
//  CJGMAdaterManager.m
//  CJModileGMAdapter
//
//  Created by shanghailingye on 2024/4/24.
//

#import "CJGMAdaterManager.h"

@interface CJGMAdaterManager()<BUAdSDKPrivacyProvider>

@end

static BOOL isSetup = NO;

@implementation CJGMAdaterManager

- (NSString * _Nonnull)adapterVersion {
    return ADAPTER_VERSION;
}

- (nonnull BUMCustomAdapterVersion *)basedOnCustomAdapterVersion {
    return BUMCustomAdapterVersion1_1;
}

- (void)initializeAdapterWithConfiguration:(BUMSdkInitConfig * _Nullable)initConfig {
    [CJGMAdaterManager setupCJSDKWithAppId:initConfig.appID];
}

- (void)didReceiveConfigUpdateRequest:(nonnull BUMUserConfig *)config {
}

- (void)didRequestAdPrivacyConfigUpdate:(nonnull NSDictionary *)config {
    [[BUAdSDKConfiguration configuration] setPrivacyProvider:self];
}

- (NSString * _Nonnull)networkSdkVersion {
    return [BUAdSDKManager SDKVersion];
}

+ (void)setupCJSDKWithAppId:(NSString *)appId {
    if (!isSetup) {
        [CJADManager openDebugLog];
        [CJADManager configure:appId completeHandle:^(BOOL success, NSError * _Nullable error) {
            isSetup = success;
        }];
    }
}

@end
